Page({
  // 扫描二维码方法
  scanQRCode() {
    wx.scanCode({
      onlyFromCamera: true,
      // scanType: ['qrCode'],
      success: (res) => {
        console.log('扫描成功', res.result);
        wx.showToast({
          title: '扫描成功',
          icon: 'success'
        });
      },
      fail: (err) => {
        console.error('扫描失败', err);
        wx.showToast({
          title: '扫描失败',
          icon: 'none'
        });
      }
    });
  },
  handleButtonClick(e) {
    const action = e.currentTarget.dataset.action;
    console.log('-----=', action);
    // 根据 action 标识跳转到对应的界面
    switch (action) {
      case 'storage':
        wx.navigateTo({
          url: `/pages/storage/index`
        });
        break;
      case 'delivery':
        wx.navigateTo({
          url: `/pages/delivery/index`
        });
        break;
      case 'returnStorage':
        wx.navigateTo({
          url: `/pages/returnStorage/index`
        });
        break;
      case 'transfer':
        wx.navigateTo({
          url: `/pages/transfer/index`
        });
        break;
      case 'pipeCutting':
        wx.navigateTo({
          url: `/pages/pipeCutting/index`
        });
        break;
      case 'scrapping':
        wx.navigateTo({
          url: `/pages/scrapping/index`
        });
        break;
      default:
        console.log(`未处理的 action: ${action}`);
    }
    console.log(`点击了 ${action} 按钮`);
  }
});
